home *** CD-ROM | disk | FTP | other *** search
- #include <stdio.h>
-
- void copyfiles( FILE *source, FILE *sink )
- {
- int ch;
- while ((ch = fgetc( source )) != EOF) fputc( ch, sink );
- }
-
- int main( int argc, char *argv[] )
- {
- FILE *source = fopen( "myfile", "r" );
- if (source)
- {
- copyfiles( source, stdout );
- fclose( source );
- return 0;
- }
- else
- {
- fprintf( stderr, "Could not open myfile\n" );
- return 1;
- }
- }
-